package com.mysterymall.Controller.Admin;

import com.mysterymall.Common.Comp.Log;
import com.mysterymall.Common.Utils.Result;
import com.mysterymall.Model.Dto.BlindBoxGroupDto;
import com.mysterymall.Service.BlindBoxGroupService;
import org.springframework.web.bind.annotation.*;

/**
 * @ClassName com.mysterymall.Controller.Admin
 * @Description
 * @Author HuangWX
 * @Time 2023/11/16  11:48
 */
@RestController
@RequestMapping("/blindBoxGroup")
public class AdminBlindBoxGroupController {

    /**
     * 盲盒分组服务
     */
    private final BlindBoxGroupService blindBoxGroupService;

    /**
     * 构造器注入
     * @param blindBoxGroupService 盲盒分组服务
     */
    public AdminBlindBoxGroupController(BlindBoxGroupService blindBoxGroupService) {
        this.blindBoxGroupService = blindBoxGroupService;
    }


    /**
     * 新建盲盒分组
     * @param blindBoxGroupDto 盲盒分组信息
     * @return Result
     */
    @PostMapping("/addBlindBoxGroup")
    @Log
    public Result addBlindBoxGroup(@RequestBody BlindBoxGroupDto blindBoxGroupDto) {
        return blindBoxGroupService.addBlindBoxGroup(blindBoxGroupDto);
    }


    /**
     * 查询盲盒分组 (管理员)
     * @param currIndex 当前页
     * @param pageSize 每页条数
     * @return Result
     */
    @GetMapping("/getBlindBoxGroup")
    @Log
    public Result getBlindBoxGroup(@RequestParam("currIndex")Integer currIndex, @RequestParam("pageSize") Integer pageSize){
        return blindBoxGroupService.getBlindBoxGroup(currIndex,pageSize);
    }


    /**
     * 删除盲盒分组
     * @param blindBoxGroupId 盲盒分组id
     * @return Result
     */
    @GetMapping("/deleteBlindBoxGroup")
    @Log
    public Result deleteBlindBoxGroup(@RequestParam("blindBoxGroupId")String blindBoxGroupId){
        return blindBoxGroupService.deleteBlindBoxGroup(blindBoxGroupId);
    }



    /**
     * 查询盲盒分组 (单个盲盒分组)
     * @param blindBoxGroupId 盲盒分组id
     * @return Result
     */
    @GetMapping("/getBlindBoxGroupMonocle")
    @Log
    public Result getBlindBoxGroupMonocle(@RequestParam("blindBoxGroupId")String blindBoxGroupId){
        return blindBoxGroupService.getBlindBoxGroupMonocle(blindBoxGroupId);
    }


    /**
     * 修改盲盒分组
     * @param blindBoxGroupDto 盲盒分组信息
     * @return Result
     */
    @PostMapping("/updateBlindBoxGroup")
    @Log
    public Result updateBlindBoxGroup(@RequestBody BlindBoxGroupDto blindBoxGroupDto){
        return blindBoxGroupService.updateBlindBoxGroup(blindBoxGroupDto);
    }
}
